**************************************************************************************************
*** This do file creates the replication results for 
*** The Political Economy of Natural Disaster Damage                  	 					 	*/
*** Eric Neumayer (LSE), Thomas Pluemper (U of Essex) and Fabian Barthel (LSE)      */
*** 																							*/
*** Published in:  Global Environmental Change, 24, 2014, pp. 8-19												*/
**************************************************************************************************
**************************************************************************************************
/* Note: You have to change "local DIR" to the directory you copy the original stata files contained 	*/
/* in the zip file and then run the do file. 
/* You must have Stata version 12 or higher installed													*/
**************************************************************************************************
*/

version 11
drop _all
clear matrix
clear mata


***********************************************************************************
local DIR = "C:\Research\Disasters\Munich Re\"  /*change relative path to the directory where the files are located */
cd "`DIR'"
***********************************************************************************

use "Article for GEC (political economy of disaster damage)", clear

set seed 10101

** Main estimations

* Quakes
label var lnprop_t_gs32_magnitude "quake propensity"
xi: sqreg  lndis_loss_overall_usd1995  lnt_gs32_magnitude    lnprop_t_gs32_magnitude    lngdppc   lngdp if  dis_subevent=="gs", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_t_gs32_magnitude
test [q25=q75]: lnprop_t_gs32_magnitude
quietly xi: bsqreg  lndis_loss_overall_usd1995  lnt_gs32_magnitude    lnprop_t_gs32_magnitude    lngdppc   lngdp if  dis_subevent=="gs", quantile(.5) reps(100)
grqreg lnprop_t_gs32_magnitude, ci seed(10101) level(90) save(quake propensity effect)
graph save quake_prop, replace

* Tropical Cyclones
label var lnprop_t3_top_wind_speed "cyclone propensity"
xi: sqreg  lndis_loss_overall_usd1995  lnt3_top_wind_speed    lnprop_t3_top_wind_speed    lngdppc   lngdp if  dis_subevent=="tc", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_t3_top_wind_speed
test [q25=q75]: lnprop_t3_top_wind_speed
quietly xi: bsqreg  lndis_loss_overall_usd1995  lnt3_top_wind_speed    lnprop_t3_top_wind_speed    lngdppc   lngdp if  dis_subevent=="tc", quantile(.5) reps(100)
grqreg lnprop_t3_top_wind_speed, ci seed(10101) level(90) save(cyclone propensity effect)
graph save cyclone_prop, replace

* Floods
label var lnprop_sum_precip_abs_pos "flood propensity"
xi: sqreg  lndis_loss_overall_usd1995   lnsum_precip_abs_pos lnprop_sum_precip_abs_pos lngdppc   lngdp if  dis_subevent=="gf", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_sum_precip_abs_pos
test [q25=q75]: lnprop_sum_precip_abs_pos
quietly xi: bsqreg  lndis_loss_overall_usd1995   lnsum_precip_abs_pos lnprop_sum_precip_abs_pos lngdppc   lngdp if  dis_subevent=="gf", quantile(.5) reps(100)
grqreg lnprop_sum_precip_abs_pos, ci seed(10101) level(90) save(flood propensity effect)
graph save flood_prop, replace


** Include income group fixed effects and small island nation state dummy
* Quakes
xi: sqreg  lndis_loss_overall_usd1995  lnt_gs32_magnitude    lnprop_t_gs32_magnitude    lngdppc   lngdp inc_* small_island_state_wb  insurance_penetration if  dis_subevent=="gs", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_t_gs32_magnitude
quietly xi: bsqreg  lndis_loss_overall_usd1995  lnt_gs32_magnitude    lnprop_t_gs32_magnitude    lngdppc   lngdp inc_* small_island_state_wb   insurance_penetration if  dis_subevent=="gs", quantile(.5) reps(100)
grqreg lnprop_t_gs32_magnitude, ci seed(10101) level(90) save(quake propensity effect)
graph save quake_prop_incdums, replace

* Tropical Cyclones
xi: sqreg  lndis_loss_overall_usd1995  lnt3_top_wind_speed    lnprop_t3_top_wind_speed    lngdppc   lngdp inc_* small_island_state_wb  insurance_penetration if  dis_subevent=="tc", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_t3_top_wind_speed
quietly xi: bsqreg  lndis_loss_overall_usd1995  lnt3_top_wind_speed    lnprop_t3_top_wind_speed    lngdppc   lngdp inc_* small_island_state_wb  insurance_penetration if  dis_subevent=="tc", quantile(.5) reps(100)
grqreg lnprop_t3_top_wind_speed, ci seed(10101) level(90) save(cyclone propensity effect)
graph save cyclone_prop_incdums, replace

* Floods
xi: sqreg  lndis_loss_overall_usd1995   lnsum_precip_abs_pos lnprop_sum_precip_abs_pos lngdppc   lngdp inc_* small_island_state_wb  insurance_penetration if  dis_subevent=="gf", quantile(.05 .25 .5 .75 .95) reps(100)
test [q05=q25=q50=q75=q95]: lnprop_sum_precip_abs_pos
quietly xi: bsqreg  lndis_loss_overall_usd1995   lnsum_precip_abs_pos lnprop_sum_precip_abs_pos lngdppc   lngdp inc_* small_island_state_wb  insurance_penetration if  dis_subevent=="gf", quantile(.5) reps(100)
grqreg lnprop_sum_precip_abs_pos, ci seed(10101) level(90) save(flood propensity effect)
graph save flood_prop_incdums, replace

** Test for non-linear effect of GDP pc

capture drop lngdppc_sq
gen lngdppc_sq=lngdppc*lngdppc

* Quakes
xi: sqreg  lndis_loss_overall_usd1995  lnt_gs32_magnitude    lnprop_t_gs32_magnitude    lngdppc lngdppc_sq  lngdp if  dis_subevent=="gs", quantile(.05 .25 .5 .75 .95) reps(100)

* Tropical Cyclones
xi: sqreg  lndis_loss_overall_usd1995  lnt3_top_wind_speed    lnprop_t3_top_wind_speed    lngdppc lngdppc_sq  lngdp if  dis_subevent=="tc", quantile(.05 .25 .5 .75 .95) reps(100)

* Floods
xi: sqreg  lndis_loss_overall_usd1995   lnsum_precip_abs_pos lnprop_sum_precip_abs_pos lngdppc  lngdppc_sq lngdp if  dis_subevent=="gf", quantile(.05 .25 .5 .75 .95) reps(100)

